package Model;

public class BaseMessage 
{
	private byte[] NO_DATA = {1};
	
	protected enum eCode
	{
		Success((byte)1), Error((byte)1);
		
		byte m_Value;
		
		private eCode(byte i)
		{
			m_Value = i;
		}
		
		public byte getCode()
		{
			return m_Value;
		}
	}
	
	protected static byte[] build(eCode code, Object... arrays)
	{
		int size = 0;
		for (int i = 0; i < arrays.length; i++) 
		{
			size += ((byte[])arrays[i]).length;
		}
		
		byte[] array = new byte[size];
		
		
		int counter = 0;
		for (int i = 0; i < arrays.length; i++) 
		{
			System.arraycopy(arrays[i], 0, array, counter, ((byte[])arrays[i]).length);
			counter += ((byte[])arrays[i]).length;
		}		
		
		return array;
	}
	
	// default pull - do nothing
	public byte[] pull()
	{
		return build(eCode.Success, NO_DATA);
	}
	
	// default push - do nothing
	public void push(){}
}
